<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box{
      width: 200px;
      height: 200px;
      margin: 50px auto;
      background-color: rgb(197, 93, 93);
    }
    .box2{
      width: 200px;
      height: 200px;
      margin: 50px auto;
      background-color: rgb(22, 102, 207);
    }
    .ani1-enter{
      transform: translateX(-500px) rotate(360deg) scale(.1);
      opacity: 0;
    }
    .ani1-enter-active,.ani1-leave-active{
      transition: all 300ms;
    }
    .ani1-leave-to{
      transform: translateY(500px) rotate(360deg) scale(.1);
      opacity: 0;
    }
  </style>
</head>
<body>
  
  <div id="app">
    <button @click="isShow=!isShow">{{isShow?'消失':'显示'}}</button>
    <transition name="ani1" mode="out-in">
      <div key="1" class="box" v-if="isShow"></div>
      <div key="2" class="box2" v-else></div>
  </transition>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        isShow: true
      }
    })
  </script>
</body>
</html>